package soundsystem;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
 * Created by jack on 18/5/28.
 */

//下面的表明了该类会作为组件类，并且告知spring要为这个类创建bean
@Component
public class SgtPeppers implements CompactDisc{
    private String title = "Sgt. Pepper's Lonely Hearts Club Band";
    private String artist = "The Beatles";
    static int index = 0;
    private int self_index = 0;
    public SgtPeppers(String title,String artist) {
        this.title = title;
        this.artist = artist;
        System.out.println("index = " + index);
        index += 1;
        self_index = index;
    }

    public void play() {
        System.out.println("Playing " + title + " by " + artist + " index = " + self_index);
    }
}
